package com.baor.controller;

import com.baor.domain.GoodsVo;
import com.baor.service.GoodsService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/goodsList")
    public AjaxResult<?> goodsList(@RequestBody Map<String, Object> params) {
        return goodsService.goodsList(params);
    }

    @RequestMapping("/goodsInfo")
    public AjaxResult<?> goodsInfo(@RequestBody GoodsVo goodsVo) {
        return goodsService.goodsInfo(goodsVo);
    }

    @RequestMapping("/insertGoods")
    public AjaxResult<?> insertGoods(@RequestBody GoodsVo goodsVo) {
        return goodsService.insertGoods(goodsVo);
    }

    @RequestMapping("/updateGoods")
    public AjaxResult<?> updateGoods(@RequestBody GoodsVo goodsVo) {
        return goodsService.updateGoods(goodsVo);
    }

    @RequestMapping("/deleteGoods")
    public AjaxResult<?> deleteGoods(@RequestBody List<GoodsVo> goodsVo) {
        return goodsService.deleteGoods(goodsVo);
    }

    @RequestMapping("/recycleList")
    public AjaxResult<?> recycleList(@RequestBody Map<String, Object> params) {
        return goodsService.recycleList(params);
    }

    @RequestMapping("/restoreGoods")
    public AjaxResult<?> restoreGoods(@RequestBody List<GoodsVo> goodsVo) {
        return goodsService.restoreGoods(goodsVo);
    }

    @RequestMapping("/unShelve")
    public AjaxResult<?> unShelve(@RequestBody List<GoodsVo> goodsVo) {
        return goodsService.unShelve(goodsVo);
    }

    @RequestMapping("/Shelve")
    public AjaxResult<?> Shelve(@RequestBody List<GoodsVo> goodsVo) {
        return goodsService.Shelve(goodsVo);
    }
}
